home *** CD-ROM | disk | FTP | other *** search
/ IRIX Base Documentation 2001 May / SGI IRIX Base Documentation 2001 May.iso / usr / share / catman / p_man / cat3 / perl5 / User::grent.z / User::grent
Encoding:
Text File  |  1998-10-30  |  3.0 KB  |  133 lines

  1.  
  2.  
  3.  
  4. UUUUsssseeeerrrr::::::::ggggrrrreeeennnntttt((((3333))))                                                  UUUUsssseeeerrrr::::::::ggggrrrreeeennnntttt((((3333))))
  5.  
  6.  
  7.  
  8. NNNNAAAAMMMMEEEE
  9.      User::grent - by-name interface to Perl's built-in getgr*() functions
  10.  
  11. SSSSYYYYNNNNOOOOPPPPSSSSIIIISSSS
  12.       use User::grent;
  13.       $gr = getgrgid(0) or die "No group zero";
  14.       if ( $gr->name eq 'wheel' && @{$gr->members} > 1 ) {
  15.           print "gid zero name wheel, with other members";
  16.       }
  17.  
  18.       use User::grent qw(:FIELDS;
  19.       getgrgid(0) or die "No group zero";
  20.       if ( $gr_name eq 'wheel' && @gr_members > 1 ) {
  21.           print "gid zero name wheel, with other members";
  22.       }
  23.  
  24.       $gr = getgr($whoever);
  25.  
  26.  
  27. DDDDEEEESSSSCCCCRRRRIIIIPPPPTTTTIIIIOOOONNNN
  28.      This module's default exports override the core _g_e_t_g_r_e_n_t(), _g_e_t_g_r_u_i_d(),
  29.      and _g_e_t_g_r_n_a_m() functions, replacing them with versions that return
  30.      "User::grent" objects.  This object has methods that return the similarly
  31.      named structure field name from the C's passwd structure from _g_r_p._h;
  32.      namely name, passwd, gid, and members (not mem).  The first three return
  33.      scalars, the last an array reference.
  34.  
  35.      You may also import all the structure fields directly into your namespace
  36.      as regular variables using the :FIELDS import tag.  (Note that this still
  37.      overrides your core functions.)  Access these fields as variables named
  38.      with a preceding gr_.  Thus, $group_obj->_g_i_d() corresponds to $gr_gid if
  39.      you import the fields.  Array references are available as regular array
  40.      variables, so @{ $group_obj->_m_e_m_b_e_r_s() } would be simply @gr_members.
  41.  
  42.      The _g_e_t_p_w() funtion is a simple front-end that forwards a numeric
  43.      argument to _g_e_t_p_w_u_i_d() and the rest to _g_e_t_p_w_n_a_m().
  44.  
  45.      To access this functionality without the core overrides, pass the use an
  46.      empty import list, and then access function functions with their full
  47.      qualified names.  On the other hand, the built-ins are still available
  48.      via the CORE:: pseudo-package.
  49.  
  50. NNNNOOOOTTTTEEEE
  51.      While this class is currently implemented using the Class::Struct module
  52.      to build a struct-like class, you shouldn't rely upon this.
  53.  
  54. AAAAUUUUTTTTHHHHOOOORRRR
  55.      Tom Christiansen
  56.  
  57.  
  58.  
  59.  
  60.  
  61.  
  62.  
  63.                                                                         PPPPaaaaggggeeee 1111
  64.  
  65.  
  66.  
  67.  
  68.  
  69.  
  70. UUUUsssseeeerrrr::::::::ggggrrrreeeennnntttt((((3333))))                                                  UUUUsssseeeerrrr::::::::ggggrrrreeeennnntttt((((3333))))
  71.  
  72.  
  73.  
  74.  
  75.  
  76.  
  77.  
  78.  
  79.  
  80.  
  81.  
  82.  
  83.  
  84.  
  85.  
  86.  
  87.  
  88.  
  89.  
  90.  
  91.  
  92.  
  93.  
  94.  
  95.  
  96.  
  97.  
  98.  
  99.  
  100.  
  101.  
  102.  
  103.  
  104.  
  105.  
  106.  
  107.  
  108.  
  109.  
  110.  
  111.  
  112.  
  113.  
  114.  
  115.  
  116.  
  117.  
  118.  
  119.  
  120.  
  121.  
  122.  
  123.  
  124.  
  125.  
  126.                                                                         PPPPaaaaggggeeee 2222
  127.  
  128.  
  129.  
  130.  
  131.  
  132.  
  133.